package com.learn.xueer.ui.activity

import android.os.Bundle
import com.learn.xueer.app.appViewModel
import com.learn.xueer.app.base.BaseActivity
import com.learn.xueer.databinding.ActivityAboutBinding
import com.learn.xueer.ui.viewmodel.MineViewModel
import me.hgj.jetpackmvvm.util.ActivityMessenger

/**
 * 关于
 */
class AboutAppActivity : BaseActivity<MineViewModel, ActivityAboutBinding>() {


    inner class ProxyClick {
        fun back() {
            finish()
        }

        fun use() {
            ActivityMessenger.startActivity<ProtocolActivity>(
                this@AboutAppActivity,
                "data" to appViewModel.about.value?.use_agreement.toString(),
                "name" to "学而时习使用协议"
            )
        }

        fun yinsi() {
            ActivityMessenger.startActivity<ProtocolActivity>(
                this@AboutAppActivity,
                "data" to appViewModel.about.value?.privacy_agreement.toString(),
                "name" to "学而时习隐私政策"
            )
        }

        fun child() {
            ActivityMessenger.startActivity<ProtocolActivity>(
                this@AboutAppActivity,
                "data" to appViewModel.about.value?.protect_agreement.toString(),
                "name" to "儿童隐私保护政策"
            )
        }

        fun yinsi2() {
            ActivityMessenger.startActivity<ProtocolActivity>(
                this@AboutAppActivity,
                "data" to appViewModel.about.value?.abstract.toString(),
                "name" to "隐私政策摘要"
            )
        }

        fun user_inventory() {
            ActivityMessenger.startActivity<ProtocolActivity>(
                this@AboutAppActivity,
                "data" to appViewModel.about.value?.user_inventory.toString(),
                "name" to "个人信息手机清单"
            )
        }

        fun sdk_inventory() {
            ActivityMessenger.startActivity<ProtocolActivity>(
                this@AboutAppActivity,
                "data" to appViewModel.about.value?.sdk_inventory.toString(),
                "name" to "第三方共享与SDK清单"
            )
        }

        fun auth_inventory() {
            ActivityMessenger.startActivity<ProtocolActivity>(
                this@AboutAppActivity,
                "data" to appViewModel.about.value?.auth_inventory.toString(),
                "name" to "设备权限清单"
            )
        }


    }

    override fun initView(savedInstanceState: Bundle?) {
        mDatabind.click = ProxyClick()
        mDatabind.viewmodel = mViewModel

//        CacheDataManager.clearAllCache(this@ClearCacheActivity)
//        ToastUtils.showShort("清除缓存成功")
    }
}